home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / coding / 80x86 / rzr92asm.lzh / endpart.asm < prev    next >
Assembly Source File  |  1992-12-29  |  13KB  |  540 lines

  1.            .286
  2.            assume cs:_code, ds:_code
  3.  
  4. ─────────────────────────────────────────────────────────────────────────────
  5. _Stack Segment Para Stack 'Stack'
  6.     db 512 dup (?)
  7. _Stack EndS
  8. ─────────────────────────────────────────────────────────────────────────────
  9. ; The Externals
  10. ─────────────────────────────────────────────────────────────────────────────
  11.  
  12. Procedures:
  13.  
  14. EXTRN  INITIALIZE:FAR            ; Initializes the modplayer for given
  15.                                  ; sounddevice and replayrate
  16.  
  17. EXTRN  LOADMODULE:FAR            ; Loads the Module into memory
  18.  
  19. EXTRN  STARTPLAYING:FAR          ; Starts playing the module
  20.  
  21. EXTRN  STOPPLAYING:FAR           ; Stops playing the module
  22.  
  23. EXTRN  DEALLOC:FAR               ; Deallocates and erases the module
  24.                                  ; from memory
  25.  
  26. EXTRN  ASKINIT:FAR
  27.  
  28. Variables:
  29.  
  30. EXTRN  SOUNDDEVICE:WORD          ; The Sounddevice number
  31.  
  32. EXTRN  TIMERSPEED:WORD           ; The replayrate 1193182/Hertz
  33.  
  34. EXTRN  SBDMA:WORD                ; SoundBlaster's DMA-Channel
  35.  
  36. EXTRN  SBIRQNR:WORD              ; SoundBlaster's IRQ-Number
  37.  
  38. Special_Variables:
  39.  
  40. EXTRN  BAR1,BAR2,BAR3,BAR4:WORD  ; Selfdecrementing Bars, see the docs
  41.  
  42. EXTRN  SHOWPATTERNS:Word         ; Shows the patterns
  43.  
  44. EXTRN  MASTERVOLUME:Word         ; Mastervolume from 0 to 64
  45.  
  46. ─────────────────────────────────────────────────────────────────────────────
  47. _Data  Segment Para Public 'Data'
  48.        Filename db 'BLOODM.MOD',0
  49.  
  50.        Error1   Db 13,10,10,7,'Module not found',13,10,'$'
  51.        PlayMess Db 13,10,10,'Playing . . .',13,10
  52.                 Db 'Press ESCAPE to quit$'
  53.  
  54. _Data  EndS
  55.  
  56. ─────────────────────────────────────────────────────────────────────────────
  57.  
  58. _stack     segment stack 'stack' use16
  59.            db 128 dup (0)
  60. _stack     ends
  61.  
  62. double     segment use16
  63. screen     db 65535 dup(0)
  64. double     ends
  65.  
  66. _code      segment public use16
  67. endscroll  db "-*- RAZOR 1911 PC DIVISION -*-" ; f¢rste skærmbillede...
  68.            db "WAS PRESENTING: X-MAS '92 DEMO"
  69.            db "                              "
  70.            db "ALL CODING WAS DONE BY        "
  71.            db "   EXCESSIVE KNIGHT <RZR/ACID>"
  72.            db "                              "
  73.            db "GRAPHICS & FONT WAS MADE BY   "
  74.            db "       BLACK SPYRIT <RZR/ACID>"
  75.            db "                              "
  76.            db "THE VECTORS WAS DESIGNED BY   "
  77.            db "   EXCESSIVE KNIGHT <RZR/ACID>"
  78.            db "         THE RAPIST           "
  79.  
  80.            db "  THIS DEMO WAS CODED IN THE  "
  81.            db " END OF THE YEAR 1992. IT WAS "
  82.            db "  FINISHED AND PRESENTED AT   "
  83.            db " THE PARTY 1992, IN AARS, DK  "
  84.            db "                              "
  85.            db " MUSIC BY INDEPENDENT ARTISTS "
  86.            db "                              "
  87.            db "    BASICALLY, THIS WAS A     "
  88.            db "    'LAST-MINUTE' DEMO...     "
  89.  
  90.            db "    GREETINGS GOES OUT TO     "
  91.            db "------------------------------"
  92.            db "   P H O N E Y  C O D E R S   "
  93.            db "        C A S C A D A         "
  94.            db "      F A I R L I G H T       "
  95.            db "     F U T U R E  C R E W     "
  96.            db "     U L T R A F O R C E      "
  97.            db "         T R I T O N          "
  98.            db "           T R S I            "
  99.            db "  T H E  H U M B L E  G U Y S "
  100.            db "      S P A C E  P I G S      "
  101.            db "   C O D E B L A S T E R S    "
  102.  
  103.            db "      PERSONAL GREETINGS      "
  104.            db "------------------------------"
  105.            db "  ALL DUDES FROM RAZOR 1911 PC"
  106.            db "       ALL IN RAZOR 1911 AMIGA"
  107.            db "                BITFREAK (TPC)"
  108.            db "               MACRO NIT (FLT)"
  109.            db "             MARSHAL (2000 AD)"
  110.            db "           HARDGORE (AMBROSIA)"
  111.            db "      JEFFE & ICEMAN (CASCADA)"
  112.            db "------------------------------"
  113.            db "   AND WE DIDN'T JUST GREET   "
  114.            db "     EVERYBODY WE KNOW!!!     ",255
  115. letternr   dw 0
  116. ddac       db 768 dup(0)
  117. boldfont   label byte
  118.            include bold.db
  119. dac        db 768 dup(0)
  120. dac2       db 0,0,0,0,0,63
  121.            i = 0
  122.            REPT 64
  123.            db i,0,0
  124.            i = i + 1
  125.            ENDM
  126.            i = 63
  127.            REPT 64
  128.            db 0,0,i
  129.            i = i - 1
  130.            ENDM
  131.            i = 63
  132.            REPT 64
  133.            db 0,i,0
  134.            i = i - 1
  135.            ENDM
  136.            ; color 194
  137.            db 51 dup(0)
  138.            db 3 dup(64),3 dup(61),3 dup(58),3 dup(55)
  139.            db 3 dup(52),3 dup(49),3 dup(46),3 dup(43)
  140.            db 3 dup(40),3 dup(37),3 dup(34),3 dup(31)
  141.            db 3 dup(28),3 dup(25),3 dup(22),3 dup(19)
  142.            db 0,0,60,0,0,50,0,0,40,0,0,30,0,0,20
  143.            ; color 232
  144.            i = 20
  145.            REPT 8
  146.            db 0,i,i
  147.            i = i + 6
  148.            ENDM
  149.            i = 63
  150.            REPT 8
  151.            db 0,0,i
  152.            i = i - 5
  153.            ENDM
  154.            ; color 248
  155.            db 63,0,0,   0,63,0,   0,0,63,   63,63,0,   63,0,63,   0,63,63,   63,63,63
  156.  
  157. calcoffs   macro     ;(x,y) = (cx,ax)
  158.            mov bx,320
  159.            mul bx
  160.            add ax,cx
  161.            endm
  162.  
  163. savedac    proc      near
  164.            mov       dx,3c8h
  165.            mov       al,0
  166.            out       dx,al
  167.            mov       cx,256
  168.            mov       dx,3c9h
  169.            sti
  170.            push      ax
  171.            push      cx
  172.            push      dx
  173. check:     mov       dx,3dah
  174.            in        al,dx
  175.            test      al,1
  176.            jz        check
  177.            pop       dx
  178.            pop       cx
  179.            pop       ax
  180. step:      push      ax
  181.            push      dx
  182.            mov       dx,3dah
  183. instep:    in        al,dx
  184.            test      al,1
  185.            jz        instep
  186.            pop       dx
  187.            pop       ax
  188.            lodsb
  189.            out       dx,al
  190.            lodsb
  191.            out       dx,al
  192.            lodsb
  193.            out       dx,al
  194.            loop      step
  195.            cli
  196.            ret
  197. savedac    endp
  198.  
  199. fontletter proc near               ; cx,ax = x,y     bh = color    dl = char
  200.            mov si,cs
  201.            mov ds,si
  202.            mov si,offset boldfont
  203.            add si,79
  204.            push bx
  205.            push dx
  206.            CALCOFFS
  207.            pop dx
  208.            pop bx
  209.            mov di,double
  210.            mov es,di
  211.            mov di,offset screen
  212.            add di,ax
  213.            mov ax,dx
  214.            xor ah,ah
  215.            shl ax,4
  216.            add si,ax
  217.            mov cx,16
  218. flnext:
  219.            lodsb
  220.            test al,128
  221.            je fl2
  222.            mov es:[di],bh
  223. fl2:
  224.            test al,64
  225.            je fl3
  226.            mov es:[di+1],bh
  227. fl3:
  228.            test al,32
  229.            je fl4
  230.            mov es:[di+2],bh
  231. fl4:
  232.            test al,16
  233.            je fl5
  234.            mov es:[di+3],bh
  235. fl5:
  236.            test al,8
  237.            je fl6
  238.            mov es:[di+4],bh
  239. fl6:
  240.            test al,4
  241.            je fl7
  242.            mov es:[di+5],bh
  243. fl7:
  244.            test al,2
  245.            je fl8
  246.            mov es:[di+6],bh
  247. fl8:
  248.            test al,1
  249.            je fl9
  250.            mov es:[di+7],bh
  251. fl9:
  252.            add di,320
  253.            inc bh
  254.            loop flnext
  255.            ret
  256. fontletter endp
  257.  
  258.            ; ds:si = text
  259.            ; cx,ax = x,y
  260.            ; di = no. of chars
  261.            ; bh = color
  262. writestr   proc near
  263. wsn:
  264.            push cx
  265.            push ax
  266.            push ds
  267.            push si
  268.            push bx
  269.            push di
  270.            mov dl,ds:[si]
  271.            call fontletter
  272.            pop di
  273.            pop bx
  274.            pop si
  275.            pop ds
  276.            pop ax
  277.            pop cx
  278.            add cx,9
  279.            inc si
  280.            dec di
  281.            cmp di,0
  282.            jne wsn
  283.            ret
  284. writestr   endp
  285.  
  286. writescr   proc near
  287.            mov si,_code
  288.            mov ds,si
  289.            mov si,offset endscroll
  290.            add si,cs:letternr
  291.            mov ax,4
  292.  
  293.            REPT 12
  294.            mov cx,25
  295.            push ax
  296.            push si
  297.            mov di,30
  298.            mov bh,232
  299.            call writestr
  300.            pop si
  301.            pop ax
  302.            add si,30
  303.            add ax,16
  304.            ENDM
  305.            ret
  306. writescr   endp
  307.  
  308. enfade     proc near
  309.            mov cx,64
  310. xenun:
  311.            push cx
  312.            mov cx,700
  313. xenun2:
  314.            mov di,cx
  315.            dec di
  316.            cmp cs:ddac[di],0
  317.            je xenup
  318.            dec cs:ddac[di]
  319. xenup:
  320.            loop xenun2
  321.            pop cx
  322.            REPT 2
  323.            mov ax,cs
  324.            mov ds,ax
  325.            mov si,offset ddac
  326.            push cx
  327.            call savedac
  328.            pop cx
  329.            ENDM
  330.            loop xenun
  331.            mov cx,64
  332. sxenun:
  333.            push cx
  334.            mov cx,68
  335. sxenun2:
  336.            mov di,cx
  337.            dec di
  338.            add di,700
  339.            cmp cs:ddac[di],0
  340.            je sxenup
  341.            dec cs:ddac[di]
  342. sxenup:
  343.            loop sxenun2
  344.            pop cx
  345.            REPT 5
  346.            mov ax,cs
  347.            mov ds,ax
  348.            mov si,offset ddac
  349.            push cx
  350.            call savedac
  351.            pop cx
  352.            ENDM
  353.            loop sxenun
  354.            ret
  355. enfade     endp
  356.  
  357. clearpiccy proc near
  358.            mov di,double
  359.            mov es,di
  360.            mov di,offset screen
  361.            mov cx,200
  362. cpn:
  363.            mov al,cl
  364.            shr al,3
  365.            add al,20
  366.            push cx
  367.            mov cx,320
  368.            rep stosb
  369.            pop cx
  370.            loop cpn
  371.            ret
  372. clearpiccy endp
  373.  
  374. createpic  proc near
  375.            mov di,0a000h
  376.            mov es,di
  377.            xor di,di
  378.            mov si,double
  379.            mov ds,si
  380.            mov si,offset screen
  381.            mov cx,101
  382. cpx:
  383.            push cx
  384.            mov bp,99
  385.            sub bp,cx
  386.            mov ax,100
  387.            sub ax,bp
  388.            mov cx,320
  389.            mul cx
  390.            push di
  391.            push si
  392.            mov di,ax
  393.            add si,ax
  394.            mov cx,320
  395.            rep movsb
  396.            pop si
  397.            pop di
  398.            mov ax,100
  399.            add ax,bp
  400.            mov cx,320
  401.            mul cx
  402.            push di
  403.            push si
  404.            mov di,ax
  405.            add si,ax
  406.            mov cx,320
  407.            rep movsb
  408.            pop si
  409.            pop di
  410.            mov ax,99
  411.            sub ax,bp
  412.            mov cx,320
  413.            mul cx
  414.            push di
  415.            push si
  416.            mov di,ax
  417.            add si,ax
  418.            mov cx,320
  419.            mov al,254
  420.            rep stosb
  421.            pop si
  422.            pop di
  423.            mov ax,101
  424.            add ax,bp
  425.            mov cx,320
  426.            mul cx
  427.            push di
  428.            push si
  429.            mov di,ax
  430.            add si,ax
  431.            mov cx,320
  432.            mov al,254
  433.            rep stosb
  434.            pop si
  435.            pop di
  436.            pusha
  437.            mov ax,8600h
  438.            mov cx,0
  439.            mov dx,20000
  440.            int 15h
  441.            popa
  442.            pop cx
  443.            loop cpx
  444.            ret
  445. createpic  endp
  446.  
  447. copydac    proc near
  448.            mov di,_code
  449.            mov ds,di
  450.            mov es,di
  451.            mov si,offset dac2
  452.            mov di,offset dac
  453.            mov cx,768
  454.            rep movsb
  455.            mov si,offset dac2
  456.            mov di,offset ddac
  457.            mov cx,768
  458.            rep movsb
  459.            ret
  460. copydac    endp
  461.  
  462. start      proc near
  463.  
  464.        Mov  Ah,4Ah                ; Reduce program memory size
  465.        Mov  Bx,120000/16           ; Approx. size of compiled EXEFILE / 16 + 2
  466.        Int  21h
  467.  
  468.        Mov  Ax,_Data
  469.        Mov  Ds,Ax
  470.  
  471.        Call Askinit              ; Ask for the setup
  472.        Call Initialize           ; Initialize the SoundSystem
  473.  
  474.        Mov  Dx,Offset FileName
  475.        Call Loadmodule           ; Load the module
  476.        Jnc  NoError
  477.  
  478.        Mov  Ah,09h
  479.        Lea  Dx,Error1
  480.        Int  21h                  ; Print the error-message
  481.  
  482.        Mov  Ah,4Ch
  483.        Int  21h                  ; Exit if error...
  484.        NoError:
  485.  
  486.            mov ax,13h
  487.            int 10h
  488.  
  489.        Call StartPlaying         ; Roll it !
  490.        Mov  Al,01111010b         ; Mask off all unneccesary interrupts.
  491.        Out  21h,Al
  492.  
  493.  
  494.  
  495. nscr:
  496.            call copydac
  497.            mov si,_code
  498.            mov ds,si
  499.            mov si,offset dac2
  500.            call savedac
  501.  
  502.            call clearpiccy
  503.            call writescr
  504.            call createpic
  505.  
  506.            call enfade
  507.  
  508.            mov di,0a000h
  509.            mov es,di
  510.            xor di,di
  511.            mov cx,32000
  512.            mov ax,0
  513.            rep stosw
  514.  
  515.            add cs:letternr,360
  516.            mov si,cs:letternr
  517.            cmp cs:endscroll[si],255
  518.            jne nottt
  519.            mov cs:letternr,0
  520. nottt:
  521.            in al,60h
  522.            cmp al,127
  523.            ja nscr
  524.  
  525.            mov al,0
  526.            out 21h,al
  527.            call stopplaying
  528.            call dealloc
  529.  
  530.            mov ax,3
  531.            int 10h
  532.  
  533.            mov ax,4c00h
  534.            int 21h
  535.            ret
  536. start      endp
  537.  
  538. _code      ends
  539.            end start
  540.